/*
 *
 *方法的整理与重构
 *
 *
 */

//定义app参数名称，并加载其它模块
var authApp=angular.module('authapp', ["ngCookies",'ngFileUpload','ui.bootstrap']);

//此为定位页面所用
authApp.value('page','fileInfo');

/*controller部分*/


//定义父controller，主要用于controller之间传递信息
authApp.controller("fcontroller",function($scope,$http){
})


//主要操作controller
authApp.controller("opinionListcontroller",function($scope,$http,$cookies, $getQueryString){
	$scope.accounttype = $cookies.get('accounttype')
    //针对此页面需要的参数 should edit
    $scope.isAddM=true;
    $scope.isAddPwd=true;
    $scope.isclickBtn=false;
    $scope.list = {}
    
    var option = {
        schoolId: $getQueryString("schoolId"),
        son_target_id: $getQueryString('son_target_id') || ''
    }
    //**********主体方法
   
    $scope.queryMain=function(){
        $http({
           method:'post',
           url:apis.queryApplyFileBySchoolId2,
           data:option,
        }).success(function(response){
            if(response.code=="000000"){
                $scope.list.name = response.data.s_employment_distribution_filename
                $scope.list.path = response.data.s_employment_distribution_filepath
            }else{
                alert(response.errorMsg);
            }
        }).error(function(){
            alert("网络出现故障，请确认网络是否连接");
        })
    }

    $scope.queryMain();

    /*下面为自已编辑部分*/

    //调用主接口成功之后的处理方法

    $scope.turnTo = function(path) {
	// $http({
	// 	method:'get',
	// 	url:apis.downSchoolFile ,
	// 	params:{"path": path},
	// }).success(function(response){
	// 	if(response.code=="000000"){
	// 		//$scope.files 
	// 		//$scope.files(response.data[0].p_id)\
	// 		totext(response.data)
	// 	}else{
	// 		alert(response.errorMsg);
	// 	}
	// }).error(function(){
	// 	alert("网络出现故障，请确认网络是否连接");
	// })  
		return window.location.href= apis.downloadsFile + '?path=' + path	 
	
   }
   
})

